<div id="edit-user" class="content scaffold-edit" role="main">
    <h1><g:message code="ljoj.onlinejudge.profile.setting.title" args="[userInstance.username]" /></h1>
    <g:if test="${flash.message}">
        <div class="message" role="status">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${userInstance}">
        <ul class="errors" role="alert">
            <g:eachError bean="${userInstance}" var="error">
                <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message error="${error}"/></li>
            </g:eachError>
        </ul>
    </g:hasErrors>
    <g:form method="post" >
        <g:hiddenField name="id" value="${userInstance?.id}" />
        <g:hiddenField name="version" value="${userInstance?.version}" />

        <fieldset class="form">
            <div class="fieldcontain ${hasErrors(bean: userInstance, field: 'username', 'error')} required">
                <label for="username">
                    <g:message code="ljoj.onlinejudge.user.username.label" default="Username" />
                    <span class="required-indicator">*</span>
                </label>
                <g:textField name="username" required="" value="${userInstance?.username}"/>
            </div>

            <div class="fieldcontain ${hasErrors(bean: userInstance, field: 'email', 'error')} required">
                <label for="email">
                    <g:message code="ljoj.onlinejudge.user.email.label" default="-Email" />
                    <span class="required-indicator">*</span>
                </label>
                <g:field type="email" name="email" required="" value="${userInstance?.email}"/>
            </div>

            <div class="fieldcontain ${hasErrors(bean: userInstance, field: 'province', 'error')} ">
                <label for="province">
                    <g:message code="ljoj.onlinejudge.user.province.label" default="Province" />

                </label>
                <g:select id="province" name="province.id" from="${com.luojiaoj.location.Province.list()}" optionKey="id" value="${userInstance?.province?.id}" class="many-to-one" noSelection="['null': '']"/>
            </div>

            <div class="fieldcontain ${hasErrors(bean: userInstance, field: 'city', 'error')} ">
                <label for="city">
                    <g:message code="ljoj.onlinejudge.user.city.label" default="City" />

                </label>
                <g:select id="city" name="city.id" from="${com.luojiaoj.location.City.list()}" optionKey="id" value="${userInstance?.city?.id}" class="many-to-one" noSelection="['null': '']"/>
            </div>

            <div class="fieldcontain ${hasErrors(bean: userInstance, field: 'school', 'error')} ">
                <label for="school">
                    <g:message code="ljoj.onlinejudge.user.school.label" default="School" />

                </label>
                <g:select id="school" name="school.id" from="${com.luojiaoj.location.School.list()}" optionKey="id" value="${userInstance?.school?.id}" class="many-to-one" noSelection="['null': '']"/>
            </div>

            <div class="fieldcontain ${hasErrors(bean: userInstance, field: 'nickname', 'error')} ">
                <label for="nickname">
                    <g:message code="ljoj.onlinejudge.user.nickname.label" default="Nickname" />

                </label>
                <g:textField name="nickname" maxlength="16" value="${userInstance?.nickname}"/>
            </div>

            <div class="fieldcontain ${hasErrors(bean: userInstance, field: 'motto', 'error')} ">
                <label for="motto">
                    <g:message code="ljoj.onlinejudge.user.motto.label" default="Motto" />

                </label>
                <g:textArea name="motto" cols="40" rows="5" maxlength="255" value="${userInstance?.motto}"/>
            </div>

            <div class="fieldcontain ${hasErrors(bean: userInstance, field: 'birthday', 'error')} ">
                <label for="birthday">
                    <g:message code="ljoj.onlinejudge.user.birthday.label" default="Birthday" />

                </label>
                <g:datePicker name="birthday" precision="day"  value="${userInstance?.birthday}" default="none" noSelection="['': '']" />
            </div>

            <div class="fieldcontain ${hasErrors(bean: userInstance, field: 'languageType', 'error')} ">
                <label for="languageType">
                    <g:message code="ljoj.onlinejudge.user.languageType.label" default="Language Type" />

                </label>
                <g:select id="languageType" name="languageType.id" from="${com.luojiaoj.type.LanguageType.list()}" optionKey="id" value="${userInstance?.languageType?.id}" class="many-to-one" noSelection="['null': '']"/>
            </div>
        </fieldset>
        <fieldset class="buttons">
            <g:actionSubmit class="save btn btn-primary" action="update" value="${message(code: 'ljoj.onlinejudge.profile.setting.update', default: 'Update')}" />
        </fieldset>
    </g:form>
</div>


